<%= render partial: 'spree/admin/shared/order_tabs', locals: { current: :adjustments} %>

<% content_for :page_title do %>
   / <%= Spree.t(:adjustments) %>
<% end %>

<% content_for :page_actions do %>
  <%= button_link_to(Spree.t(:new_adjustment), new_admin_order_adjustment_url(@order), class: "btn-success", icon: 'add.svg') if can? :create, Spree::Adjustment %>
<% end %>

<% if @adjustments.present? %>
  <div class="card mb-3">
    <%= render partial: 'adjustments_table' %>
  </div>
<% else %>
  <div class="alert alert-warning">
    <%= Spree.t(:no_resource_found, resource: plural_resource_name(Spree::Adjustment)) %>
  </div>
<% end %>

<% if @order.can_add_coupon? %>
  <div class="card bg-light mb-3" data-hook="adjustments_new_coupon_code">
    <div class="card-body">
      <div class="form-group">
        <%= text_field_tag "coupon_code", "", placeholder: Spree.t(:coupon_code), class: "form-control" %>
      </div>
      <%= button Spree.t(:add_coupon_code), 'add.svg', 'submit', id: "add_coupon_code" %>
    </div>
  </div>
<% end %>

<script>
  var order_number = '<%= @order.number %>';
</script>

<%= render partial: 'spree/admin/shared/order_summary' %>
